<?php
//No direct access
defined('_JEXEC') or die('Restricted access');
?>
<div id="ownservices">
 <div id="mainmenuownservice"><?php echo MenuHelper::nav(); ?></div>
	<div id="mainownservice">
	<h3><?php echo JText::_('OWNSERVICE_EXCHANGERATES'); ?></h3>
	<hr />
	<?php if($this->access->canAdd): ?>
	<div id="toolbar">
		<a class="toolbar" onclick="javascript: submitbutton('add')" href="#">
			<span title="<?php echo JText::_('OWNSERVICE_NEW_EXCHANGERATE'); ?>" class="icon-32-new"></span>
			<?php echo JText::_('OWNSERVICE_NEW_EXCHANGERATE'); ?>
		</a>
	</div>
	<div class="clear"> </div>
	<?php endif; ?>
	
	<form action="<?php echo JRoute::_('index.php?option=com_ownservice'); ?>" method="post" name="adminForm">
		<table>
			<tr>
				<td width="100%">
	
					<?php echo JText::_( 'OWNSERVICE_FILTER' ); ?>:<input type="text" name="search" value="<?php echo htmlspecialchars($this->lists['search']);?>"  onchange="document.adminForm.submit();" />
	
					<button onclick="this.form.submit();" class="button"><?php echo JText::_( 'Go' ); ?></button>
	
					<button onclick="document.adminForm.search.value='';this.form.submit();" class="button"><?php echo JText::_( 'Reset' ); ?></button>
	
				</td>
	
				<td nowrap="nowrap">
					<?php echo $this->lists['currency']; ?>
					<?php echo $this->lists['branch']; ?>
				</td>
			</tr>
		</table>
		<table class="adminlist" cellspacing="1">
			<tr>
				<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_CURRENCY_NAME', 'c.name', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>
				<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_CURRENCY_CODE', 'c.code', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>
				<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_EXCHANGE_RATE', 'r.rate', $this->lists['order_Dir'], $this->lists['order'] ); ?><br /></td>
				<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_THAI_RATE', 'r.th_rate', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>
				<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_BRANCH', 'b.branchcode', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>
				<td align="center" class="tablelist"><?php echo JText::_('OWNSERVICE_SELECT_ACTION'); ?></td>
			</tr>
			<tfoot>
				<tr>
				  <td colspan="6"><?php echo $this->pageNav->getListFooter(true); ?></td>
				</tr>
			</tfoot>
			<tbody>
			<?php
				$k = 0;
				$dateformat  = OwnserviceHelper::getParams('date_format', '%d/%m/%Y'); 
				for($i=0,$n=count($this->rows);$i<$n;$i++): 
				$row = $this->rows[$i];
				$link =JRoute::_('index.php?option=com_ownservice&controller=exchangerate&task=edit&id='.$row->id);
			?>
			<tr class="<?php echo "row$k"; ?>">
				<td class="inner_tablelist" align="center"><a href="<?php echo $link; ?>"><?php echo $row->name; ?></a></td>
				<td class="inner_tablelist" align="center"><?php echo $row->code; ?></td>
				<td class="inner_tablelist" align="center"><?php echo $row->rate; ?></td>
				<td class="inner_tablelist" align="center"><?php echo $row->rate_th; ?></td>
				<td class="inner_tablelist" align="center"><?php echo $row->branchname.'('.$row->branchcode.')'; ?></td>
				<td class="inner_tablelist" align="center">
					<select class="inputbox" name="action" id="action" onChange="listTaskAction(<?php echo $row->id ?>,this.value);">
						<option value="" selected><?php echo JText::_('OWNSERVICE_PLEASE_SELECT'); ?></option>
						<?php /*<?php if($this->access->canView || $this->access->canOwnView) : ?><option value="detail"><?php echo JText::_('OWNSERVICE_VIEW');?></option><?php endif; ?>*/ ?>
						<?php if($this->access->canEdit || $this->access->canEditOwn) : ?><option value="edit"><?php echo JText::_('OWNSERVICE_EDIT');?></option><?php endif; ?>
						<?php if($this->access->canDelete || $this->access->canDeleteOwn) : ?><option value="delete"><?php echo JText::_('OWNSERVICE_DELETE');?></option><?php endif; ?>
					</select>
				</td>
			</tr>
			<?php $k = 1 - $k; endfor; ?>
			</tbody>
		</table>
		<input type="hidden" name="id" value="" />
		<input type="hidden" name="option" value="com_ownservice" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="Itemid" value="<?php echo JRequest::getVar('Itemid'); ?>" />
		<input type="hidden" name="controller" value="exchangerate" />
		<input type="hidden" name="view" value="exchangerates" />
		<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
		<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
	</form>
	</div>
</div>